n = int(input())
max_sum = -1
best_id = ""
best_name = ""

for _ in range(n):
    parts = input().split()
    student_id = parts[0]
    name = parts[1]
    score1 = int(parts[2])
    score2 = int(parts[3])
    score3 = int(parts[4])
    total = score1 + score2 + score3
    if total > max_sum:
        max_sum = total
        best_id = student_id
        best_name = name

print(f"{best_name} {best_id} {max_sum}")